/*
* INSANE - Interactive Structural Analysis Environment
*
* Copyright (C) 2003-2005
* Universidade Federal de Minas Gerais
* Escola de Engenharia
* Departamento de Engenharia de Estruturas
* 
* Author's email :    insane@dees.ufmg.br
* Author's website :  http://www.dees.ufmg.br/insane
* 
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
* 
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
* 
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/
package br.ufmg.dees.insane.analysisModel;

import java.util.ArrayList;

import br.ufmg.dees.insane.util.IMatrix;
import br.ufmg.dees.insane.util.IVector;
import br.ufmg.dees.insane.util.geometricProperties.GeometricProperties;

/**
*A class representing an analysis model.
*
*@author Fonseca, Flavio & Lucas, Marcelo & Pitangueira, Roque, & Camara, Luciana & CENOURA & Fuina,Jamile!!!
*@version 1.0
*@since September 2003
*/

public interface AnalysisModel {

    /** Returns the Internal Variable Operator matrix related to 
	 * analysis model type (Ex: matrix B)
	*@param d The matrix containing local derivates of shape functions.
	*@param d2 The matrix containing local second derivates of shape functions.
	*@param n The vector containing shape functions in natural coordinates.
	*@param c The matrix containing nodal coordinates in cartesian system.
	*@return The matrix representing the transformation between internal variable and state variable (B) 
	*/
	public abstract IMatrix getInternalVariableOperator(IMatrix d, IMatrix d2, IVector n, IMatrix c);
	
    /** Returns the Internal Variable operator matrix related to analysis model type 
	*@param d The matrix containing derivates of the shape functions.
	*@param d2 The matrix containing local second derivates of shape functions.
	*@param n The vector containing shape functions.
	*@param c The matrix containing nodal coordinates.
	*@param u The matrix containing the nodal state variables
	*@return The matrix representing the transformation between internal variable and state variable (B)
	*/
	public abstract IMatrix getInternalVariableOperator(IMatrix d, IMatrix d2, IVector n, IMatrix c, IMatrix u);
		
	/** Mounts the matrix of the material properties for the analysis model type.
	*@param e The matrix of material properties.
	*@return The matrix representing the transformation between dual internal variable and the internal variable (D) 
	*/
	public abstract IMatrix getDualInternalVariableOperator(IMatrix e);
	
	/** Modify matrix of the Internal Variable Operator for the analysis model type.
	*@param e The matrix representing the transformation between internal variable and state variable (B).
	*@param p The matrix of material properties.
	*@return The matrix B modified.
	*/
	public abstract IMatrix modifyInternalVariableOperator(IMatrix e, IMatrix p);
	
	/** Modify matrix of the Dual Internal Variable Operator for the analysis model type.
	*@param e The matrix representing the transformation between dual internal variable and the internal variable (D).
	*@param gps The GeometricProperties of Degeneration.
	*@return The Dual Internal Variable Operator modified.
	*/
	public abstract IMatrix modifyDualInternalVariableOperator(IMatrix e, GeometricProperties gps);
	
	/** Modify vector of the Dual Internal Variable Vector for the analysis model type.
	*@param e The Dual Internal Variable Vector.
	*@param gps The GeometricProperties of Degeneration.
	*@return The Dual Internal Variable Vector modified.
	*/
	public abstract IVector modifyDualInternalVariableVector(IVector s, GeometricProperties gps);
	
	/** Mounts the State Variable operator matrix accordingly to the AnalysisModel.
	*@param d The matrix containing local derivates of shape functions.
	*@param n The vector containing shape functions in natural coordinates.
	*@param c The matrix containing nodal coordinates in cartesian system.
	*@return The State Variable operator matrix accordingly to the AnalysisModel type.
	*/
	public abstract IMatrix getStateVariableOperator(IMatrix d, IVector n, IMatrix c);
	
	/** Mounts the Geometric operator matrix accordingly to the AnalysisModel.
	 *  The geometric operator is a matrix that transforms the nodal coordinates into a given point coordinates
	*@param n1 A IVector containing the shape functions values.
	*@return The Geometric operator matrix accordingly to the AnalysisModel type.
	*/
	public abstract IMatrix getGeometricOperator(IVector n1);
	
	/** Return the number of internal variables according to this Analysis model type.*/
	public abstract int getNumberOfInternalVariables();
	
	/** Return the number of dual internal variables according to this Analysis model type.*/
	public abstract int getNumberOfDualInternalVariables();
	
	/** Return the non zero internal variables tensor that perform in one point. 
	*@param a The IVector containing internal variables tensor of the point.
	*@param b The Material that will be used to obtain material properties.
	*@return internalVariablesTensor The IVector according this Analysis Model.
	*/
	public abstract IMatrix getInternalVariablesTensor(IVector a, IMatrix b);
	
	/** Return the non zero internal dual variables tensor that perform in one point. 
	*@param a The IVector containing dual internal variables tensor of the point.
	*@param b The Material that will be used to obtain material properties.
	*@return InternalDualVariablesTensorVector The IVector according this Analysis Model.
	*/
	public abstract IMatrix getDualInternalVariablesTensor(IVector a, IMatrix b);
	
	/** Return the String representing the non zero internal variables labels of this Analysis Model.
	*@return The string containing the label of non zero internal labels direction of this Analysis Model.
	*/
	public abstract String[] getInternalVariablesLabels();
	
	/** Return the String representing the non zero internal dual variables labels of this Analysis Model.
	*@return The string containing the label of non zero internal dual variables labels of this Analysis Model.
	*/
	public abstract String[] getDualInternalVariablesLabels();
	
	/** Expand the vector containing internal variables to a vector(6). 
	*@param a The IVector containing internal variables of the point.
	*@return Vector The IVector(6) according this Analysis Model.
	*/
	public abstract IVector expandVector(IVector a);
	
	/** Expand the vector containing internal variables to a tensor(3x3). 
	*@param a The IVector containing internal variables of the point.
	*@return Tensor The IMatrix(3x3) according this Analysis Model.
	*/
	public abstract IMatrix expandTensor(IVector a);
	
	/** Reduce the vector(6) to the vector containing internal variables. 
	*@param a The IVector(6) containing internal variables of the point.
	*@return Vector The IVector according this Analysis Model.
	*/
	public abstract IVector reduceVector(IVector a);
	
	/** Reduce the Tensor(3x3) to the vector containing internal variables. 
	*@param a The IMatrix(3x3) containing internal variables of the point.
	*@return Vector The IVector according this Analysis Model.
	*/
	public abstract IVector reduceTensor(IMatrix a);
	
    /** Returns the type of this Analysis Model.
	*@return a The type of this Analysis Model.
	*/
	public abstract String getLabel()
	;
	
	/** Returns the Dominion of this Analysis Model.
	*@return a The Dominio of this Analysis Model.
	*/
	public abstract int getDominion()
	;
	
	/** Return the integration factor according to analysis model type.
	*@param n The vector containing the shape functions.
	*@param cN The matrix containing the nodal coordinates in cartesian system.
	*@param gps The GeometricProperties of Degeneration.
	*@return The integration factor according to analysis model type.
	*/
	public abstract double getIntegrationFactor(IVector n, IMatrix cN, GeometricProperties gps);
	
	/** Return the jacobian transformation according to analysis model type.
	*@param dl The matrix containing local derivates of shape functions.
	*@param cN The matrix containing the nodal coordinates in cartesian system.
	*@return The jacobian transformation according to analysis model type.
	*/
	public abstract double getJacobianTransformation(IMatrix dl, IMatrix cN);
	
	
	/** Returns the transformation matrix between local and global axis accordingly to this AnalysisModel type.
	*@param dl The matrix containing local derivates of shape functions.
	*@param cN The matrix containing the nodal coordinates in cartesian system.
	*@return The transformation matrix between local and global axis accordingly to this AnalysisModel type.
	*/
	public abstract IMatrix getTransformationMatrix(IMatrix dl, IMatrix cN);
    
    /** Returns the second invariant of deviatoric stress of a given stress tensor.
    *@param s The stress tensor.
    */
    public abstract double getJ2 (IVector s);
        
    /** Returns the derivative of the second invariant of deviatoric stresses w.r.t. the stress components.
    *@param s The stress tensor.
    *@return The derivative of the second invariant of deviatoric stresses.
    */
    public abstract IVector getdJ2dSIG (IVector s);
    
    /** Returns the third invariant of deviatoric stress of a given stress tensor.
     *@param s The stress tensor.
     */
     public abstract double getJ3 (IVector s);
         
     /** Returns the derivative of the third invariant of deviatoric stresses w.r.t. the stress components.
     *@param s The stress tensor.
     *@return The derivative of the third invariant of deviatoric stresses.
     */
     public abstract IVector getdJ3dSIG (IVector s);
     
     /** Returns the first invariant of stress of a given stress tensor.
      *@param s The stress tensor.
      */
      public abstract double getI1 (IVector s);
          
      /** Returns the derivative of the first invariant of stresses w.r.t. the stress components.
      *@param s The stress tensor.
      *@return The derivative of the first invariant of stresses.
      */
      public abstract IVector getdI1dSIG (IVector s);
      
      /** Returns the second invariant of stress of a given stress tensor.
       *@param s The stress tensor.
       */
       public abstract double getI2 (IVector s);
           
       /** Returns the derivative of the second invariant of stresses w.r.t. the stress components.
       *@param s The stress tensor.
       *@return The derivative of the second invariant of stresses.
       */
       public abstract IVector getdI2dSIG (IVector s);
       
       /** Returns the third invariant of stress of a given stress tensor.
        *@param s The stress tensor.
        */
        public abstract double getI3 (IVector s);
            
        /** Returns the derivative of the third invariant of stresses w.r.t. the stress components.
        *@param s The stress tensor.
        *@return The derivative of the third invariant of stresses.
        */
        public abstract IVector getdI3dSIG (IVector s);
        
        /** Returns the labels of this analysis model degrees of freedom.
        *@param n The number of nodes.
        */
    	public abstract ArrayList getDOFLabels(int n);
    	 /** Returns the labels of this analysis model degrees of freedom.
         *@param n The number of nodes.
         */
    	
    	public abstract ArrayList getDOFLabels();
    	
    	/** Returns the P matrix used to calculate J2 and the gradient of yield surface w.r.t. the stress components in associative plasticity. 
	     *@return The P matrix used to calculate J2 and the gradient of yield surface w.r.t. the stress components in associative plasticity. 
	     */
	    public abstract IMatrix getPMatrix();	       

}
